<template>
  <div>
    <van-cell
      :title="obj.name"
      :label="
        (str = hasSong
          ? obj.song.artists[0].name
          : obj.artists[0].name + '  ' + obj.name)
      "
      center
      v-for="obj in List"
      :key="obj.id"
      @click="goComment"
    >
      <!-- 使用 right-icon 插槽来自定义右侧图标 -->
      <template #right-icon>
        <van-icon
          name="play-circle-o"
          class="search-icon"
          @click="playFn(obj.id)"
        />
      </template>
    </van-cell>
  </div>
</template>

<script>
export default {
  data() {
    return {};
  },
  props: ["List", "hasSong"],
  methods: {
    playFn(id) {
      // 点击图标，路由跳转到播放页面
      this.$router.push({
        path: "/play",
        query: {
          id: id,
        },
      });
    },
    goComment() {
      this.$router.push({
        path: "/comment",
      });
    },
  },
};
</script>